Skip to content

[core] Merge developing branch into main#197

Draft
forfudan wants to merge 17 commits intomainfrom
dev
Draft

[core] Merge developing branch into main#197
forfudan wants to merge 17 commits intomainfrom
dev

Conversation

@forfudan
Copy link
Copy Markdown
Owner

@forfudan forfudan commented Apr 9, 2026

No description provided.

forfudan added 7 commits April 4, 2026 01:15
…d files (#190)

This PR introduces initial scaffolding and documentation for optional
MPFR/GMP integration, including a C shared-library wrapper (loaded via
`dlopen`/`dlsym`) and Mojo-side FFI bindings intended to support a
future MPFR-backed `BigFloat` type.

**Changes:**
- Added a C-based MPFR wrapper with lazy runtime loading plus a build
script and pixi tasks to compile it.
- Added Mojo FFI bindings (`mpfr_wrapper.mojo`) and a placeholder
`bigfloat.mojo` for the upcoming `BigFloat` API.
- Updated repository documentation/licensing notes (NOTICE + planning
doc) and ignore rules for generated shared libraries.
This PR adds a detailed enhancement/audit plan for the
`decimo.decimal128` module, capturing cross-language comparisons,
identified correctness gaps, performance bottlenecks, and a prioritized
execution order.

**Changes:**
- Introduces a comprehensive design/audit document for `Decimal128`,
including a cross-language feature matrix.
- Documents key architectural concerns (notably the 2^96−1 coefficient
bound) and related performance implications.
- Lists suspected correctness/performance issues and proposes a phased
implementation plan.
…strings + Eliminate `mojo doc` warnings (#194)

This PR focuses on improving generated documentation by adding/expanding
docstrings across the TOML tokenizer/parser and the numeric types
(BigInt/BigUInt/BigDecimal/Decimal128/etc.), with the goal of
eliminating `mojo doc` warnings.

**Changes:**
- Added docstrings for structs, fields, constants, and many methods
across the codebase.
- Standardized docstring sections (Args/Returns/Parameters) in multiple
modules.
- Removed an unused error-message header constant from `errors.mojo`.
…e name and line number) (#195)

This PR refactors Decimo’s error handling to produce Python-style
tracebacks with ANSI coloring, and updates many call sites to raise
typed `DecimoError[...]` variants (e.g., `ValueError`, `OverflowError`)
with consistent metadata (message/function/previous error).

**Changes:**
- Reworked `DecimoError` formatting to mimic Python tracebacks,
including chained errors and ANSI colors.
- Updated many modules to raise structured `DecimoError` variants
instead of raw string `Error(...)` messages.
- Removed explicit `file=` parameters at many raise sites in favor of
auto-captured file/line via `call_location()`.
…or` type (#196)

This PR updates Decimo’s structured error type so that `DecimoError`
always includes a `message` and `function`, ensuring tracebacks
consistently show both fields (alongside auto-captured file/line).

**Changes:**
- Make `DecimoError.message` and `DecimoError.function` mandatory
(non-optional) and require them in `__init__`.
- Update error construction call sites across parsing, numeric parsing,
and numeric types to pass `message` + `function`.
- Convert a couple of previously string-raised errors to structured
`ValueError` instances to comply with the new contract.
@forfudan forfudan changed the title [error] Remove Error wrapper + Replace DecimoError with more specific error types [core] Merge developing branch into main Apr 9, 2026
@forfudan forfudan marked this pull request as draft April 9, 2026 18:50
forfudan added 10 commits April 9, 2026 22:22
… Replace `DecimoError` with specific error types (#198)

This PR refactors Decimo’s error-handling to raise the library’s typed
`DecimoError[...]` aliases directly (e.g., `ValueError`,
`OverflowError`) instead of wrapping them in `Error(...)`, introduces a
`RuntimeError` type, and updates call sites/tests accordingly.

**Changes:**
- Remove redundant `Error(...)` wrappers across TOML parsing, numeric
parsing, and arithmetic modules.
- Add `RuntimeError` as a `DecimoError[...]` alias and update
runtime-infrastructure failure sites (e.g., MPFR
availability/allocation).
- Replace uses of the generic `DecimoError` wrapper with more specific
error types (and update tests to match).
…base to show correct error types (#199)

This PR updates docstring `Raises:` sections across Decimo to replace
generic `Error` entries with specific error types (e.g., `ValueError`,
`OverflowError`, `ZeroDivisionError`, `ConversionError`) so API
documentation more accurately reflects runtime behavior.

**Changes:**
- Standardized and expanded docstring `Raises:` sections across TOML
parsing, numeric parsing, and multiple numeric types (Decimal128/Big*).
- Replaced generic `Error`/`DecimoError` docstring entries with concrete
error types used by the implementation.
- Added missing `Raises:` sections to several functions that previously
had none.
…in error messages to ensure privacy at compilation (#200)

This PR updates Decimo’s error reporting to avoid exposing absolute file
system paths in error messages by shortening file paths captured via
`call_location()`.

**Changes:**
- Added a `_shorten_path()` helper to convert absolute paths into
`./src/...`, `./tests/...`, `./benches/...`, or filename-only paths.
- Updated `DecimoError.__init__` to store the shortened path instead of
the raw `call_location()` path.
…validation + custom usage line (#201)

This PR enhances the `decimo` CLI calculator’s argument parsing and
help/usage UX by leveraging newer ArgMojo features, and updates project
documentation/plans accordingly.

**Changes:**
- Add ArgMojo metadata to CLI options/flags (value names, numeric range
validation, help groups) and set a custom usage line.
- Enable ArgMojo negative-number passthrough for positional expressions.
- Update docs/plans to reflect ArgMojo v0.5.0 integration and adjust
pixi tasks for fetching ArgMojo source.
This PR updates the Decimo CLI argument parsing so expressions that
start with `-` (e.g., negative numbers / negative expressions) can be
passed as the positional `<EXPR>` more naturally, and documents/tests
the behavior.

**Changes:**
- Enable hyphen-prefixed values for the `expr` positional argument via
ArgMojo (`allow_hyphen=True`) and remove the older command-level
negative-number allowance.
- Expand CLI integration tests to cover negative expressions, mixed
option/positional ordering, and `--` separator cases.
- Add user-manual documentation for “Negative Expressions” and update
the CLI calculator plan checklist accordingly.
…de (#203)

This PR updates the Decimo CLI to avoid short-flag collisions with
negative expressions by uppercasing short options, and adds new stdin
(pipe) + file-based input modes for evaluating multiple expressions.

**Changes:**
- Uppercase short flags for formatting/computation options
(`-P/-S/-E/-D/-R`) and remove the `--pad` short flag to prevent
collisions with expressions like `-e`, `-pi`, `-sin(1)`.
- Add pipe mode (read/evaluate expressions from stdin, one per non-empty
non-comment line) and file mode (`-F/--file`).
- Extend integration/unit tests and update docs/changelog/plans for the
new CLI UX.
This PR adds an interactive REPL mode to the Decimo CLI so `decimo` with
no arguments (and TTY stdin) launches an interactive calculator session,
aligning CLI UX with tools like `bc`. The PR also updates related CLI
docs/changelog and refines benchmark comparison logic.

**Changes:**
- Launch REPL when no expression/file is provided and stdin is a TTY;
add REPL implementation, prompt writer, and line-reading helper.
- Update CLI docs/changelog to describe REPL mode and revise the CLI
benchmark script to compare full-precision digits (with a guard digit).
- Normalize various docstrings to use single-backtick inline code
formatting.
This PR updates the documents and re-organize the "docs" folder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant